﻿<Application 
    x:Class="ThcStartingHandsGenerator.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:Controls="clr-namespace:HandGenerator.Controls;assembly=HandGenerator.Controls"
    xmlns:View="clr-namespace:ThcStartingHandsGenerator.View"
    xmlns:ViewModel="clr-namespace:HandGenerator.ViewModel;assembly=HandGenerator.ViewModel"
    StartupUri="View/MainWindow.xaml" >
    
    <Application.Resources>

        <!--ContextMenu x:Key="PaletteContextMenu">
            <MenuItem Header="Change Color to Selected?" 
                      Command="{Binding Parent, ElementName=HandOptionBorder.DataContext.MenuItemCommand, Mode=OneWay}"/>
        </ContextMenu-->

        <Controls:StartingHandHoldemColorConverter x:Key="HighlightColorConverter" />
        
        <DataTemplate x:Key="StartingHandColorListBoxDataTemplate">
            <StackPanel x:Name="stackPanel" Orientation="Horizontal" 
                        HorizontalAlignment="Stretch">
                <Label 
                    Content="        " 
                    Background="{Binding ColorBrush}" />
                <Label Content="{Binding ColorName}" />
            </StackPanel>
        </DataTemplate>
        
        <DataTemplate x:Key="StartingHandColorPaletteListBoxDataTemplate">
            <StackPanel Orientation="Vertical">
                <Label Width="50" Content="{Binding Id}" />
                <Label Width="50" Height="25" Background="{Binding ColorBrush}" />
            </StackPanel>
        </DataTemplate>
        
        <Style x:Key="THCTextBlockHeaderCenter" TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="FontSize" Value="24" />
        </Style>

        <SolidColorBrush x:Key="ListBorder" Color="#828790"/>
        <ControlTemplate x:Key="HoldemColorScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
            <Grid x:Name="Grid">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Rectangle x:Name="Corner" Grid.Column="1" Fill="{x:Null}" Grid.Row="1"/>
                <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
                <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Background="{x:Null}">
                    <ScrollBar.BorderBrush>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="Black" Offset="0"/>
                            <GradientStop Color="White" Offset="1"/>
                        </LinearGradientBrush>
                    </ScrollBar.BorderBrush>
                </ScrollBar>
                <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
            </Grid>
        </ControlTemplate>
        <Style x:Key="HoldemColorListBoxStyle" TargetType="{x:Type ListBox}">
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
            <Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
            <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBox}">
                        <Border x:Name="Bd" Padding="1" SnapsToDevicePixels="true">
                            <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}" Template="{StaticResource HoldemColorScrollViewerControlTemplate}">
                                <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </ScrollViewer>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                            </Trigger>
                            <Trigger Property="IsGrouping" Value="true">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>    
</Application>
